<template>
  <div class="info-msg">
    <div class="lf" :style="{ width: labelWidth + 'px', borderBottom: hideBottom ? 'none' : '' }">{{ label }}</div>
    <template v-if="slotShow">
      <slot></slot>
    </template>
    <template v-else>
      <div
        v-if="!value || /<[^>]+>/g.test(value)"
        class="rf"
        :style="{ borderBottom: hideBottom ? 'none' : '' }"
        v-html="value || '--'"
      ></div>
      <a-tooltip v-else>
        <template slot="title">{{ value }}</template>
        <div class="rf" :style="{ borderBottom: hideBottom ? 'none' : '' }">{{ value }}</div>
      </a-tooltip>
    </template>
  </div>
</template>
<script>
export default {
  props: {
    label: {
      type: String,
      default: '',
    },
    labelWidth: {
      type: Number | String,
      default: 86,
    },
    hideBottom: {
      type: Boolean,
      default: false,
    },
    value: {
      type: String | Number,
      default: '',
    },
    slotShow: {
      type: Boolean,
      default: false,
    }
  },
}
</script>
<style lang="less" scoped>
.info-msg {
  width: 100%;
  height: auto;
  display: flex;
  box-sizing: border-box;
  color: #ffffff;
  .lf {
    min-height: 27px;
    height: auto;
    padding-right: 8px;
    text-align: right;
    line-height: 27px;
    background: rgba(19, 28, 50, 1);
    position: relative;
    border-right: 1px solid rgba(2, 224, 247, 0.5);
    border-bottom: 1px solid rgba(2, 224, 247, 0.5);
  }
  .rf {
    flex: 1;
    padding-left: 8px;
    text-align: left;
    line-height: 27px;
    min-height: 27px;
    height: auto;
    border-bottom: 1px solid rgba(2, 224, 247, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
</style>